import fetch from 'utils/fetch';

export function fetchTree(query) {
  return fetch({
    url: '/api/shop/shops/admin/tree',
    method: 'get',
    params: query
  });
}

export function page(query) {
  return fetch({
    url: '/api/shop/shops/admin/list',
    method: 'get',
    params: query
  });
}

export function getAllShopList() {
  return fetch({
    url: '/api/shop/shops/admin/getAllShopList',
    method: 'get'
  })
}
export function getAllPicks() {  //获取支付方式
  return fetch({
    url: '/api/param/picklist/admin/getParamPicklist',
    method: 'get'
  })
}

export function getPayingUnit() {  //获取现金支付单位
  return fetch({
    url: '/api/param/picklist/admin/getCashPayment',
    method: 'get'
  })
}

export function getPayingStaging() {  //获取分期支付单位
  return fetch({
    url: '/api/param/picklist/admin/getCashPaymentStages',
    method: 'get'
  })
}

export function addShopShops(shopShops) {  //添加店铺
  return fetch({
    url: '/api/shop/shops/admin/addShopShops',
    method: 'post',
    data: shopShops
  })
}
export function getShops(id) {   //查询店铺
  return fetch({
    url: '/api/shop/shops/admin/getShopsInfo/' + id,
    method: 'get'
  })
}

export function updateShops(shops) {  //修改店铺
  return fetch({
    url: '/api/shop/shops/admin/updateShops',
    method: 'put',
    data: shops
  })
}

export function bannerPage(query) {
  return fetch({
    url: '/api/advert/advert/front/bannerList',
    method: 'get',
    params: query
  });
}

export function bannerAdd(advert) {
  return fetch({
    url: '/api/advert/advert/front/bannerAdd',
    method: 'post',
    data: advert
  })
}

export function getBanner(id) {
  return fetch({
    url: '/api/advert/advert/front/getBanneres/' + id,
    method: 'get'
  })
}

export function bannerUpdate(advert) {
  return fetch({
    url: '/api/advert/advert/front/bannerUpdate',
    method: 'put',
    data: advert
  })
}

export function bannerDelete(id) {
  return fetch({
    url: '/api/advert/advert/front/bannerDele/' + id,
    method: 'delete'
  })
}

export function componentPage(query) {
  return fetch({
    url: '/api/shop/shops/adminComponent/list',
    method: 'get',
    params: query
  })
}

export function addShopsComponent(shopsComponent) {
  return fetch({
    url: '/api/shop/shops/adminComponent/addShopComponent',
    method: 'post',
    data: shopsComponent
  })
}

export function getComponentById(id) {
  return fetch({
    url: '/api/shop/shops/adminComponent/getComponentById/' + id,
    method: 'get'
  })
}

export function updateShopsComponent(shopsComponent) {
  return fetch({
    url: '/api/shop/shops/adminComponent/updateShopComponent',
    method: 'put',
    data: shopsComponent
  })
}